feat(agent-bundle): optional plugin.version with fail-closed releases and an agent-bundle/meta build-time constant - #270
Merged
Conversation
… build-time identity Make `plugin.version` optional (#94 stage 3, #237): package.json is the one version source, and normalization derives the plugin version from it when the config omits the field. A declared value that is not a nonempty string is still AB4001, and one that disagrees with package.json is still the AB4008 warning, so a legacy declaration never changes meaning mid-migration. Fail release builds closed (#94 stage 3): `agent-bundle build` is the only command that produces a release artifact, so it alone refuses a project with neither an authored plugin.version nor a valid package.json version, with the new AB4012 error. Development commands keep the labeled 0.0.0-dev fallback, which can therefore never reach a release artifact. Add the `agent-bundle/meta` build-time identity module (#237): every compiled plugin surface — script, CLI, MCP entry, hook, and package bundles through Rslib plus browser MCP App bundles through Rsbuild — resolves it to the exact { name, version, packageName, packageVersion } that manifests, `inspect`, and dev status report, so plugins can delete hand-written version shims. It is a real package subpath, so types ship with the export and no generated declaration is involved; it is a reserved specifier the tools hatch cannot externalize; and outside Agent Bundle compilation it throws rather than reporting a fabricated identity.
🦋 Changeset detectedLatest commit: b17c75a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 2, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers #94 stage 3 and closes #237.
Optional
plugin.versionwith package.json inference (#94 stage 3, #237a)AgentBundlePluginConfig.versionis optional. Omitted → the version is derived frompackage.json(the same axissnapshotPackageIdentityreads). Declared → the authored value still wins (legacy configs never change meaning) and a disagreement stays the AB4008 warning per Derive project identity from package version and compiler revisions #94's migration policy. Declared-but-invalid (empty/non-string) stays an AB4001 error with a message pointing at omission.Fail-closed release semantics (#94 stage 3)
validateSourcegains areleaseoption;ProjectService.prepare('build')alone sets it, soagent-bundle buildis exactly the release boundary. With no authoredplugin.versionand no validpackage.jsonversion,buildfails closed with the new AB4013 error before anything compiles;dev/inspect/validatekeep the documented labeled0.0.0-dev.<short-revision>fallback.Build-time identity constant (#237b)
agent-bundle/metaexporting{ name, version, packageName, packageVersion }(named constants + frozen aggregate). A package subpath rather than ascheme:id so types ship with the package export map and both bundler engines resolve it through one alias mechanism.toolsescape hatch. Values are exactly what manifests/inspect/dev status report. Outside compilation the published module throws a named error (no TDZ trap).examples/mcp-appnow feedsnew McpServer({ name, version })fromagent-bundle/meta;examples/audiobook-curatordrops its restatedplugin.version(the shim-deletion pattern from #237c).Docs: new "Release identity" section in
docs/diagnostics.md(AB4001, AB4008–AB4011, AB4013 — AB4012 was taken byplugin.logoin #267, so the fail-closed code landed as AB4013) and anagent-bundle/metasection indocs/entry-conventions.md. Changeset:agent-bundleminor.Test plan
package-identity.test.ts: inference, AB4001 declared-invalid, dev fallback, AB4013 shapes, and dev-succeeds/build-fails-closedProjectServiceproofmcp.test.tsfixture: noplugin.version,package.jsonat4.5.6, Node MCP bundle and browser MCP App HTML both carry the injected identity, no unresolvedagent-bundle/meta, artifact validates; dist-contract test that the published subpath throws the intended errornormalization.test.ts,plugin-logo.test.ts,cursor-adapter.test.ts(sharedvalidate.tssurface with feat(plugin): emit optional plugin.logo into Cursor manifests #267) — pass post-rebasemcp.test.ts,build.test.ts,hooks.test.ts,package-build.test.ts— passpnpm build,pnpm typecheck,pnpm lintgreen on HEAD rebased overorigin/main(includes chore(adapters): strip self-pinning of repo-owned capability tables #261/fix(build): report declaration-build failures as AB4716 with the underlying TypeScript diagnostics #265/feat(plugin): emit optional plugin.logo into Cursor manifests #267/feat(state): kernel budgets and lifetime visibility (#233 items 3-4) #268); worker run also passed the full unit pool (2376 tests)